#!/usr/bin/make -f

CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

configure: configure-stamp

configure-stamp:
	dh_testdir
	touch configure-stamp

build: build-stamp

build-stamp: configure-stamp 
	dh_testdir
	g++ -o poledump pole.cpp poledump.cpp
	qmake
	$(MAKE)
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	-$(MAKE) clean
	$(RM) poledump poleview
	$(RM) Makefile
	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	mkdir -p $(CURDIR)/debian/pole/usr/bin
	cp poledump $(CURDIR)/debian/pole/usr/bin
	cp poleview $(CURDIR)/debian/pole/usr/bin
	dh_installdirs

binary-indep: build install

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs ChangeLog
	dh_installdocs
	dh_install
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
